package com.intellagric.agriecom.controller.agriecom_news;

import com.intellagric.agriecom.module.agriecom_news.NewsService;
import com.intellagric.pojo.AgriecomNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class NewsDetailsController {

    @Autowired
    private NewsService newsService;

    @RequestMapping("/agriecomPage/news/forward")
    public String forward(@RequestParam(defaultValue = "") String newsId){return "redirect:/newDetail.html?newsId="+newsId;}

    @RequestMapping("/agriecomPage/news/details")
    @ResponseBody
    public AgriecomNews details(String newsId){
        return newsService.selectNewsById(newsId);
    }


}
